package testIO;

import java.io.*;

public class TestOutput {
    public static void main(String[] args) throws IOException {
        try (OutputStream outputStream = new FileOutputStream("stream.txt", true)) {
            PrintWriter writer = new PrintWriter(outputStream);
            writer.println("一万年太久，只争朝夕");
            writer.flush();
        }
    }
    public static void main1(String[] args) throws IOException {
        try (OutputStream outputStream = new FileOutputStream("stream.txt", true)) {
            String s = "一万年太久，只争朝夕";
            outputStream.write(s.getBytes());
        }
    }
}
